import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/laout'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'layout',
    component: Layout,
    children: [
      {
        path: '/',
        redirect: '/home'
      },
      {
        path: '/home',
        name: 'home',
        component: () => import('@/views/home'),
        meta: {
          title: '首页',
          show: true
        }
      },
      {
        path: '/updata',
        name: 'updata',
        component: () => import('@/views/updata'),
        meta: {
          title: '图片上传',
          show: true
        }
      },
      {
        path: '/table',
        name: 'table',
        component: () => import('@/views/table'),
        meta: {
          title: '表格管理',
          show: true
        }
      },
      {
        path: '/img',
        name: 'img',
        component: () => import('@/views/img'),
        meta: {
          title: '图片验证码',
          show: true
        }
      },
      {
        path: '/socket',
        name: 'socket',
        component: () => import('@/views/socket'),
        meta: {
          title: '聊天机器人',
          show: true
        }
      },
      {
        path: '/preview',
        name: 'preview',
        component: () => import('@/views/preview'),
        meta: {
          title: '图片预览',
          show: true
        }
      },
      {
        path: '/route',
        name: 'route',
        component: () => import('@/views/route'),
        meta: {
          title: '路由导航',
          show: true
        }
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
